<?php

class Skjb_Search_Xapian_PostingIterator
{
    public $_cPtr=null;

    function __construct($other=null) {
        switch (func_num_args()) {
        case 0: $r=new_PostingIterator(); break;
        default: $r=new_PostingIterator($other);
        }
        $this->_cPtr=$r;
    }

    function skip_to($did) {
        PostingIterator_skip_to($this->_cPtr,$did);
    }

    function get_doclength() {
        return PostingIterator_get_doclength($this->_cPtr);
    }

    function get_wdf() {
        return PostingIterator_get_wdf($this->_cPtr);
    }

    function positionlist_begin() {
        $r=PostingIterator_positionlist_begin($this->_cPtr);
        return is_resource($r) ? new Skjb_Search_Xapian_PositionIterator($r) : $r;
    }

    function positionlist_end() {
        $r=PostingIterator_positionlist_end($this->_cPtr);
        return is_resource($r) ? new Skjb_Search_Xapian_PositionIterator($r) : $r;
    }

    function get_description() {
        return PostingIterator_get_description($this->_cPtr);
    }

    function get_docid() {
        return PostingIterator_get_docid($this->_cPtr);
    }

    function next() {
        PostingIterator_next($this->_cPtr);
    }

    function equals($other) {
        return PostingIterator_equals($this->_cPtr,$other);
    }
}